home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NBC Slam Jams!
/
NBC Slam Jams!.iso
/
xtras
/
media_la
/
fx_set_2.fxm
/
00141_Script_Number Field
< prev
next >
Wrap
Text File
|
1998-07-02
|
3KB
|
105 lines
property pArrowsSprite, pTextSprite, pTextField, pCurVal, pActive, pCallBackObj, pRefcon
property pMin, pMax
-- SPRITES FOR THE NUMBER FIELD OBJECT:
-- Everything figures itself out from the pBackSprite0
-- The label is -1
-- The arrows are +1
-- The text field should be in +2
-- So the object occupies 4 consecutive sprites
on new me, propList, pArrowsSprite0, pTextSprite0, pTextField0, pMin0, pMax0, pCurVal0, pCallBackObj0, pRefCon0
set pArrowsSprite = getAProp(propList,#arrowsSprite)
set pTextSprite = getAProp(propList,#textSprite)
set pTextField = getAProp(propList,#textField)
set pMin = getAProp(propList,#min)
set pMax = getAProp(propList,#max)
set pCurVal = getAProp(propList,#cur)
set pActive = getAProp(propList,#active)
set pCallBackObj = getAProp(propList,#callback)
set pRefCon = getAProp(propList,#ref)
put string(pCurVal) into field pTextField
SetEnabled(me, pActive)
return(me)
end
on wait me, waitTime
put the ticks into t
repeat while the ticks < t+waitTime
end repeat
end
on Arrows me, spriteNum
if not pActive then exit
put the locV of the clickLoc into v1
put the locV of sprite the clickOn into v2
if v1 < v2 then
put "up" into side
put 1 into d
else
put "down" into side
put -1 into d
end if
set the member of sprite spriteNum = member ("vertArrows"&&side)
set pCurVal = max(min(pCurVal+d,pMax),pMin)
setVal(me,pCurVal)
updateStage
wait(me,5)
repeat while the stillDown
if rollover(spriteNum) then
set the member of sprite spriteNum = member ("vertArrows"&&side)
set pCurVal = max(min(pCurVal+d,pMax),pMin)
else
set the member of sprite spriteNum = member "vertArrows"
end if
setVal(me,pCurVal)
wait(me,5)
end repeat
set the member of sprite spriteNum = member "vertArrows"
if objectP(pCallBackObj) then EndChange(pCallBackObj)
end
on keyBoardInputDown me, k
if not pActive then exit
if "0123456789-"&BACKSPACE contains k then
pass
else
dontpassevent
end if
end
on keyBoardInputUp me, k
if not pActive then exit
put value(field pTextField) into v
if v < pMin then put string(pMin) into field pTextField
else if v > pMax then put string(pMax) into field pTextField
set pCurVal = value(field pTextField)
changeNumber(pCallBackObj, pCurVal, pRefcon)
end
on TextOut me
if voidP(pCurVal) then put " " into field pTextField
else put string(integer(pCurVal)) into field pTextField
end
on SetVal me, newVal
set pCurVal = newVal
TextOut(me)
if objectP(pCallBackObj) then changeNumber(pCallBackObj,newVal,pRefcon)
end
on SetEnabled me, enabled
set pActive = enabled
enableInterfaceElement(pArrowsSprite,enabled)
enableInterfaceElement(pTextSprite,enabled)
end
on Release me
-- release all puppets, constraints, etc.
end